//
//  LTAlbumCollectTableViewCell.m
//  聆听FM
//
//  Created by dllo on 16/6/19.
//  Copyright © 2016年 Dark. All rights reserved.
//

#import "LTAlbumCollectTableViewCell.h"

@implementation LTAlbumCollectTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.listImage.transform = CGAffineTransformRotate(self.listImage.transform, M_PI_2);
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(listTap:)];
    [self.listImage addGestureRecognizer:tap];
}

- (void)listTap:(UITapGestureRecognizer *)tap
{
    [self.delegate pushAlbumList:self.model.albumId];
}

- (void)setModel:(LTAlbumModel *)model
{
    if (_model!= model) {
        _model = model;
        [self.leftImageView sd_setImageWithURL:[NSURL URLWithString:model.albumCoverUrl290] placeholderImage:[UIImage sd_animatedGIFNamed:@"占位图"]];
        self.titleLabel.text = model.title;
        self.inforLabel.text = model.intro;
        if (model.playsCounts >= 10000) {
            self.playCountLabel.text = [NSString stringWithFormat:@"%.1f万", model.playsCounts / 10000.0];
        }
        else
        {
            self.playCountLabel.text = [NSString stringWithFormat:@"%ld", model.playsCounts];
        }
        self.numberLabel.text = [NSString stringWithFormat:@"%ld集", model.tracks];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
